package com.zyz.E_面向对象.O_代码块.非静态代码块;

/**
 * @author: vick
 * @Date: 2025/3/18
 * @Description:
 * @version: 1.0
 */
public class Demo1 {

    {
        System.out.println("非静态代码块1");
    }

    private String str = assign();

    public Demo1() {
        System.out.println("无参构造器");
    }

    public Demo1(String str) {
        this.str = str;
        System.out.println("有参构造器");
    }

    {
        System.out.println("非静态代码块2");
    }

    public String assign() {
        System.out.println("assign方法");
        return "vick";
    }
}
